<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta http-equiv="Pragma" content="no-cache">
		<meta http-equiv="Cache-Control" content="no-cache, must-revalidate">
		<meta http-equiv="expires" content="0">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>微信群管理平台</title>
		<!-- 重置样式 -->
		<link rel="stylesheet" href="../css/reset.css">
		<!-- icon -->
		<link rel="stylesheet" href="../css/fonts.css">
		<link rel="stylesheet" href="../css/animate.css">
		<link rel="stylesheet" href="../js/layui/css/layui.css">
		<link rel="stylesheet" href="../js/bootstrap/css/bootstrap.min.css">
		<link rel="stylesheet" href="../css/main.css">
	</head>
	<body>
	<!-- 公共头部 -->
	<div class="header-wrapper">
		<img class="gmmc-logo" src="../img/gmmc-logo.png">
		<div class="right">
			<span class="nickname">广汽三菱蓝天店客服马晓杰</span>
			<input class="edit-psw" type="button" value="修改密码" data-toggle="modal" data-target="#editPswModal">
			<input class="quit-login" type="button" value="退出登陆">
		</div>
	</div>
	<!-- 公共头部 -->
	
	<!-- 内容iframe -->
	<div class="iframe-wrapper">
		<iframe class="content-iframe" src="shopManager.html" frameborder="0" width="100%" height="100%"></iframe>
	</div>
	<!-- 内容iframe -->
	
	<!-- 公共导航栏 -->
	<div class="nav-wrapper">
		<ul class="nav-list">
			<li class="nav-item normal-nav">
				<a href="chatRoom.html" onclick="return false">
					<i class="iconfont icon-respond"></i>
					<span class="nav-text">聊天室</span>
				</a>
			</li>
			<li class="nav-item normal-nav">
				<a href="groupMessage.html" onclick="return false">
					<i class="iconfont icon-message"></i>
					<span class="nav-text">群发消息</span>
				</a>
			</li>
			<li class="nav-item superAdmin-nav">
				<a href="groupMesManager.html" onclick="return false">
					<i class="iconfont icon-messagewhite"></i>
					<span class="nav-text">群发管理</span>
				</a>
			</li>
			<li class="nav-item admin-nav kpi-nav">
				<a href="KPI.html" onclick="return false">
					<i class="iconfont icon-tradingdata"></i>
					<span class="nav-text">KPI总览</span>
				</a>
			</li>
			<li class="nav-item admin-nav">
				<a href="cusManager.html" onclick="return false">
					<i class="iconfont icon-groupctrl"></i>
					<span class="nav-text">客户管理</span>
				</a>
			</li>
			<li class="nav-item admin-nav">
				<a href="groupManager.html" onclick="return false">
					<i class="iconfont icon-addresslist"></i>
					<span class="nav-text">群组管理</span>
				</a>
			</li>
			<li class="nav-item active superAdmin-nav">
				<a href="shopManager.html" onclick="return false">
					<i class="iconfont icon-home"></i>
					<span class="nav-text">店铺管理</span>
				</a>
			</li>
			<li class="nav-item admin-nav">
				<a href="account.html" onclick="return false">
					<i class="iconfont icon-settings"></i>
					<span class="nav-text">帐号管理</span>
				</a>
			</li>
		</ul>
	</div>
	<!-- 修改密码Modal -->
	<div class="modal fade" id="editPswModal" tabindex="-1" role="dialog" aria-labelledby="editPswModalLabel">
		<div class="modal-dialog" role="document">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
					<h4 class="modal-title" id="editPswModalLabel">修改密码</h4>
				</div>
				<div class="modal-body">
					<form class="layui-form">
						<div class="layui-form-item">
							<label class="layui-form-label">原密码</label>
							<div class="layui-input-block">
								<input type="password" name="oldPsw" required lay-verify="required" placeholder="请输入原密码" autocomplete="off" class="layui-input" value="123456">
							</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label">新密码</label>
							<div class="layui-input-block">
								<input type="password" name="newPsw" required lay-verify="required" placeholder="请输入新密码" autocomplete="off" class="layui-input">
							</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label">确认密码</label>
							<div class="layui-input-block">
								<input type="password" name="sureNewPsw" required lay-verify="required" placeholder="请确认新密码" autocomplete="off" class="layui-input">
							</div>
						</div>
					</form>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
					<button id="sureEditPsw" type="button" class="btn danger-bg">保存</button>
				</div>
			</div>
		</div>
	</div>
	<!-- 公共导航栏 -->
	<script src="../js/jquery-3.3.1.min.js"></script>
	<script src="../js/bootstrap/js/bootstrap.min.js"></script>
	<script>
		// 点击导航栏切换样式
		$(".nav-item").click(function() {
			$(this).addClass("active").siblings().removeClass("active");
			let routHref = $(this).children("a").attr("href");
			$(".content-iframe").attr("src", routHref);
		});
		
		// 判断登陆帐号的职位  管理者显示管理导航 工作人员显示工作导航
		var role = "";
		if (role == "SA") {
			$(".admin-nav").hide();
			$(".superAdmin-nav").hide();
			$(".content-iframe").attr("src", "chatRoom.html");
			$(".nav-item").removeClass("active");
			$(".normal-nav").eq(0).addClass("active");
		} else if (role == 'admin') {
			$(".admin-nav").show();
			$(".normal-nav").hide();
			$(".superAdmin-nav").hide();
			$(".content-iframe").attr("src", "KPI.html");
			$(".nav-item").removeClass("active");
			$(".kpi-nav").addClass("active");
		} else if (role == 'superAdmin') {
			$(".normal-nav").hide();
			$(".admin-nav").hide();
			$(".nav-item").removeClass("active");
			$(".superAdmin-nav").eq(0).addClass("active");
			$(".content-iframe").attr("src", "groupMesManager.html");
		}
		// 退出登陆
		$(".quit-login").click(function() {
			window.location.href = "../login.html";
		});
		
		// 修改密码
		$(".edit-psw").click(function() {
			$("input[name=oldPsw]").val('123456'); // 赋上当前帐号的登陆密码
		});
		$("#sureEditPsw").click(function() {
			let oldPsw = $("input[name=oldPsw]").val();
			let newPsw = $("input[name=newPsw]").val();
			let sureNewPsw = $("input[name=sureNewPsw]").val();
			if (newPsw == "") {
				alert("新密码不能为空");
			} else if (sureNewPsw == "") {
				alert("确认密码不能为空");
			} else {
				console.log(oldPsw, newPsw, sureNewPsw);
				$.ajax({
					type: "POST",
					url: "",
					data: "",
					//请求成功
					success: function(data) {
						console.log(data);
					},
					//请求失败，包含具体的错误信息
					error: function(e) {
						console.log(e.status);
						console.log(e.responseText);
					}
				});
			}
		})
	</script>
	</body>
</html>
